local skel = fk.CreateSkill {
  name = "lb_zero__huiyin",
  tags = { Skill.Compulsory }
}

Fk:loadTranslationTable {
  ["lb_zero__huiyin"] = "绘音",
  --[":lb_zero__huiyin"] = "<b>锁定技</b>，当你受到伤害后，若你未因此发动“以骸”技能，且你已拥有三个同等级的以骸技能，你修改“梦谣”技能库（普通→精英→高危）。",
  [":lb_zero__huiyin"] = "<b>锁定技</b>，当你受到伤害后，若你已拥有三个同等级的“以骸”技能，你修改<a href=':lb_zero__mengyao'><font color='red'>〖梦谣〗</font></a>技能库（普通→精英→高危）。",

  ["$lb_zero__huiyin1"] = "以夜魔使者之名！",
  ["$lb_zero__huiyin2"] = "忠诚的伙伴呐！",
}

skel:addEffect(fk.Damaged, {
  --priority = 0.9,
  anim_type = "masochism",
  can_trigger = function(self, event, target, player, data)
    if player:hasSkill(skel.name) and target == player then --and not (data.extra_data and data.extra_data.lb_zero__huiyin) then
      local num = player:getMark("lb_zero__mengyao")
      local skills = {
        { "lb_zero__mengyao_leizhu",   "lb_zero__mengyao_tierfeng",           "lb_zero__mengyao_apeika",       "lb_zero__mengyao_satier",        "lb_zero__mengyao_mandela", "lb_zero__mengyao_eling", "lb_zero__mengyao_youhun" },
        { "lb_zero__mengyao_hati",     "lb_zero__mengyao_tanatuosi",          "lb_zero__mengyao_dulahan",      "lb_zero__mengyao_bannileike",    "lb_zero__mengyao_yurenxie" },
        { "lb_zero__mengyao_tepeishi", "lb_zero__mengyao_high_zhuangjiahati", "lb_zero__mengyao_high_dulahan", "lb_zero__mengyao_high_tanatuosi" }
      }
        if num > 0 and num < 4 and #table.filter(skills[num], function (skill)
          return player:hasSkill(skill, true)
        end) > 2 then
          return true
        end
    end
  end,
  on_use = function(self, event, target, player, data)
    local num = player:getMark("lb_zero__mengyao") + 1
    player.room:setPlayerMark(player, "lb_zero__mengyao", math.min(3, num))
  end,
})

return skel
